package com.baizhi.zjs.action;



import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.baizhi.zjs.entity.AdminEntity;
import com.baizhi.zjs.service.AdminServiceImpl;
import com.baizhi.zjs.util.ImageCodeUtil;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AdminAction extends ActionSupport{
	private AdminEntity admin;
	private String message;
	//接收验证码
	private String code;
public String adimnLogin(){
	System.out.println("登录的actioln");
	System.out.println(admin);
	System.out.println(code);
	//-----------
	AdminServiceImpl impl = new AdminServiceImpl();
	String string = impl.showOneAdimn(admin.getUsername(),admin.getPassword(),code);
if("coderror".equals(string)){
	message="验证码不正确";
	return "error";
}
	if(string.equals("error")){
		message="账号不正确";
		return "error";
	}
	if(string.equals( "passwordError")){
		message="密码不正确";
		return "error";
	}
	if(string.equals("ok")){
		System.out.println("action正确判断");
		return "ok";
	}
	return "error";
}




public AdminEntity getAdmin() {
	return admin;
}
public void setAdmin(AdminEntity admin) {
	this.admin = admin;
}




public String getMessage() {
	return message;
}




public void setMessage(String message) {
	this.message = message;
}




public String getCode() {
	return code;
}




public void setCode(String code) {
	this.code = code;
}


}
